#import "dfhgwhruebvhrheystallsecurity.h"
#import "dfhgwhruebvhrheyprofessionalincidentally.h"
@interface dfhgwhruebvhrheystallsecurity ()
@property (weak, nonatomic) IBOutlet UILabel *tipsText;
@property (weak, nonatomic) IBOutlet UILabel *moneyTextLabel;
@property (weak, nonatomic) IBOutlet UILabel *bottomTextLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeDateTextLabel;
@end
@implementation dfhgwhruebvhrheystallsecurity {
    UIColor *bgColor;
    UIColor *drawColor;
	void(^_callback)(dfhgwhruebvhrheystallsecurity *coupon);
}
- (void)awakeFromNib {
	[super awakeFromNib];
    bgColor = white_color.dhgfywegwygeydwlearneddesignate;
    drawColor = white_color.dhgfywegwygeydwlearneddesignate;
	UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
	[tap addTarget:self action:@selector(tapAction)];
	[self addGestureRecognizer:tap];
}
- (NSMutableAttributedString *)generateMutableAttributedString:(int)type {
    UIColor *color = (type == 1 || type == 2) ? primary_color.dhgfywegwygeydwlearneddesignate : white_color.dhgfywegwygeydwlearneddesignate;
	NSString *string = [NSString stringWithFormat:@"PHP %@",[self.money dhgfywegwygeydwlocalitylearned]];
	NSMutableAttributedString *matt = [[NSMutableAttributedString alloc] initWithString:string];
	[matt addAttributes:@{NSForegroundColorAttributeName: color, NSFontAttributeName: [UIFont regular:15]} range:NSMakeRange(0, string.length)];
	[matt addAttributes:@{NSFontAttributeName: [UIFont semiBold:36]} range:NSMakeRange(3, string.length - 3)];
	return matt;
}
- (void)setMoney:(NSString *)money {
	_money = money;
    self.moneyTextLabel.attributedText = [self generateMutableAttributedString:self.coupon.type];
}
- (void)setDateString:(NSString *)dateString {
	_dateString = dateString;
	self.timeDateTextLabel.text = dateString;
}
- (void)setCoupon:(dhgfywegwygeydwprevalentconnection *)coupon {
    _coupon = coupon;
    if (coupon.type == 1) {
        self.bottomTextLabel.text = @"Get it";
        self.tipsText.textColor = primary_color.dhgfywegwygeydwlearneddesignate;
        self.bottomTextLabel.textColor = primary_color.dhgfywegwygeydwlearneddesignate;
        self.timeDateTextLabel.textColor = primary_color.dhgfywegwygeydwlearneddesignate;
        bgColor = white_color.dhgfywegwygeydwlearneddesignate;
        drawColor = primary_color.dhgfywegwygeydwlearneddesignate;
    }else if (coupon.type == 2) {
        self.bottomTextLabel.text = @"Use";
        self.tipsText.textColor = primary_color.dhgfywegwygeydwlearneddesignate;
        self.bottomTextLabel.textColor = primary_color.dhgfywegwygeydwlearneddesignate;
        self.timeDateTextLabel.textColor = text_color1.dhgfywegwygeydwlearneddesignate;
        if (self.inCouponListView) {
            if (coupon.selected) {
                bgColor = second_color.dhgfywegwygeydwlearneddesignate;
            }else {
                bgColor = @"#F9F8FF".dhgfywegwygeydwlearneddesignate;
            }
            drawColor = primary_color.dhgfywegwygeydwlearneddesignate;
        }else {
            bgColor = second_color.dhgfywegwygeydwlearneddesignate;
            drawColor = primary_color.dhgfywegwygeydwlearneddesignate;
        }
    }else {
        self.bottomTextLabel.text = @"Get it";
        self.tipsText.textColor = white_color.dhgfywegwygeydwlearneddesignate;
        self.bottomTextLabel.textColor = white_color.dhgfywegwygeydwlearneddesignate;
        self.timeDateTextLabel.textColor = white_color.dhgfywegwygeydwlearneddesignate;
        bgColor = text_color2.dhgfywegwygeydwlearneddesignate;
        drawColor = white_color.dhgfywegwygeydwlearneddesignate;
    }
}
- (void)couponClick:(void(^)(dfhgwhruebvhrheystallsecurity *couponView))callback {
	_callback = callback;
}
- (void)tapAction {
	if (_callback) {
		_callback(self);
	}
}
- (void)layoutSubviews {
	[super layoutSubviews];
    self.backgroundColor = bgColor;
    [self drawArcAndLine:drawColor];
}
@end
